package com.qf.vote.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo())
                .select()
                //指定swagger扫描的controller包路径
                .apis(RequestHandlerSelectors.basePackage("com.qf.vote.controller"))
                .build();
    }

    private ApiInfo getApiInfo() {
        return new ApiInfoBuilder()
                .contact(new Contact("千锋教育", "http://www.baidu.com", "2589477996@qq.com"))
                .title("锋迷商城项目")
                .version("0.0.1")
                .description("锋迷商城项目的接口文档")
                .build();
    }
}
